package com.wdf.project01.service.impl;

import com.wdf.project01.pojo.Emp;
import com.wdf.project01.dao.EmpDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.wdf.project01.service.EmpService;

import java.util.List;
@Component
public class EmpServiceImpl implements EmpService {
    @Autowired
    private EmpDao empDao;
    @Override
    public List<Emp> listEmp() {
        List<Emp> empList = empDao.listEmp();
        empList.stream().forEach(emp->{
            //处理数据
            String gender = emp.getGender();
            if ("1".equals(gender)){
                emp.setGender("男");
            }else if("2".equals(gender)){
                emp.setGender("女");
            }
            String job = emp.getJob();
            if ("1".equals(job)){
                emp.setJob("副教授");
            }else if("2".equals(job)){
                emp.setJob("教授");
            }else if("3".equals(job)){
                emp.setJob("讲师");
            }
        });
        return empList;
    }
}
